<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>教师列表</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-4">
    <h1>教师列表</h1>
    <a th:href="@{/teachers/add}" class="btn btn-primary mb-3">添加教师</a>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>ID</th>
            <th>姓名</th>
            <th>职称</th>
            <th>邮箱</th>
            <th>电话</th>
            <th>部门</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="teacher : ${teachers}">
            <td th:text="${teacher.teacherId}"></td>
            <td th:text="${teacher.name}"></td>
            <td th:text="${teacher.title}"></td>
            <td th:text="${teacher.email}"></td>
            <td th:text="${teacher.phone}"></td>
            <td th:text="${teacher.department.deptName}"></td>
            <td>
                <a th:href="@{/teachers/edit/{id}(id=${teacher.teacherId})}" class="btn btn-sm btn-info">编辑</a>
                <a th:href="@{/teachers/delete/{id}(id=${teacher.teacherId})}" class="btn btn-sm btn-danger" onclick="return confirm('确定删除吗？')">删除</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>